From 1fd1a4254d2990f976ca800f2776c1d019b3db27 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 3 Dec 2010 09:36:47 +0000 Subject: [PATCH] libxc: osdep: convert xc_evtchn_bind_virq() Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- tools/libxc/xc_evtchn.c | 6 ++++++ tools/libxc/xc_linux.c | 8 +++++--- tools/libxc/xc_minios.c | 12 +++++++----- tools/libxc/xc_netbsd.c | 8 +++++--- tools/libxc/xc_solaris.c | 8 +++++--- tools/libxc/xenctrlosdep.h | 1 + 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index 25c665eaa4..fadb00cca7 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -101,6 +101,12 @@ xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid, return xce->ops->u.evtchn.bind_interdomain(xce, xce->ops_handle, domid, remote_port); } +evtchn_port_or_error_t +xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) +{ + return xce->ops->u.evtchn.bind_virq(xce, xce->ops_handle, virq); +} + /* * Local variables: * mode: C diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index 231f3fb6a2..bc5cc279fc 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -399,14 +399,15 @@ linux_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid, return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); } -evtchn_port_or_error_t -xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) +static evtchn_port_or_error_t +linux_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) { + int fd = (int)h; struct ioctl_evtchn_bind_virq bind; bind.virq = virq; - return ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); + return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); } int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) @@ -443,6 +444,7 @@ static struct xc_osdep_ops linux_evtchn_ops = { .notify = &linux_evtchn_notify, .bind_unbound_port = &linux_evtchn_bind_unbound_port, .bind_interdomain = &linux_evtchn_bind_interdomain, + .bind_virq = &linux_evtchn_bind_virq, }, }; diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c index 631078a31d..b9587a493e 100644 --- a/tools/libxc/xc_minios.c +++ b/tools/libxc/xc_minios.c @@ -346,25 +346,26 @@ int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) return 0; } -evtchn_port_or_error_t xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) +static evtchn_port_or_error_t minios_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) { + int fd = (int)h; evtchn_port_t port; int i; assert(get_current() == main_thread); - i = port_alloc(xce->fd); + i = port_alloc(fd); if (i == -1) return -1; printf("xc_evtchn_bind_virq(%d)", virq); - port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)xce->fd); + port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)fd); if (port < 0) { errno = -port; return -1; } - files[xce->fd].evtchn.ports[i].bound = 1; - files[xce->fd].evtchn.ports[i].port = port; + files[fd].evtchn.ports[i].bound = 1; + files[fd].evtchn.ports[i].port = port; unmask_evtchn(port); return port; } @@ -408,6 +409,7 @@ static struct xc_osdep_ops minios_evtchn_ops = { .notify = &minios_evtchn_notify, .bind_unbound_port = &minios_evtchn_bind_unbound_port, .bind_interdomain = &minios_evtchn_bind_interdomain, + .bind_virq = &minios_evtchn_bind_virq, }, }; diff --git a/tools/libxc/xc_netbsd.c b/tools/libxc/xc_netbsd.c index f14ad85d71..85b4d5c308 100644 --- a/tools/libxc/xc_netbsd.c +++ b/tools/libxc/xc_netbsd.c @@ -268,15 +268,16 @@ int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind); } -evtchn_port_or_error_t -xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) +static evtchn_port_or_error_t +netbsd_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) { + int fd = (int)h; struct ioctl_evtchn_bind_virq bind; int err; bind.virq = virq; - err = ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); + err = ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); if (err) return -1; else @@ -308,6 +309,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = { .notify = &netbsd_evtchn_notify, .bind_unbound_port = &netbsd_evtchn_bind_unbound_port, .bind_interdomain = &netbsd_evtchn_bind_interdomain, + .bind_virq = &netbsd_evtchn_bind_virq, }, }; diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 3e704c2c7e..2bdb985b0f 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -241,14 +241,15 @@ solaris_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid, return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind); } -evtchn_port_or_error_t -xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq) +static evtchn_port_or_error_t +solaris_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq) { + int fd = (int)h; struct ioctl_evtchn_bind_virq bind; bind.virq = virq; - return ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); + return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind); } int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port) @@ -285,6 +286,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = { .notify = &solaris_evtchn_notify, .bind_unbound_port = &solaris_evtchn_bind_unbound_port, .bind_interdomain = &solaris_evtchn_bind_interdomain, + .bind_virq = &solaris_evtchn_bind_virq, }, }; diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h index 83c79fdceb..1869ba2737 100644 --- a/tools/libxc/xenctrlosdep.h +++ b/tools/libxc/xenctrlosdep.h @@ -82,6 +82,7 @@ struct xc_osdep_ops evtchn_port_or_error_t (*bind_unbound_port)(xc_evtchn *xce, xc_osdep_handle h, int domid); evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid, evtchn_port_t remote_port); + evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq); } evtchn; } u; }; -- 2.30.2